package ljl.alg.jianzhioffer.round3.easy;

public class _3_find_repeat_number {
    
    public int findRepeatNumber(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == i) continue;
            int cur = nums[i];
            while (cur != i) {
                int other = nums[cur];
                if (other == cur) return cur;
                nums[i] = other;
                nums[cur] = cur;
                cur = other;
            }
        }
        return 8848;
    }
}
